package com.syh.jn.scm.domain.supplier.entity.finance;

import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.core.ddd.domain.AbstractSimpleAggregate;
import com.syh.jn.scm.dto.supplier.finance.orderExpensesBill.OrderExpensesBillMto;
import com.syh.jn.scm.dto.supplier.finance.orderExpensesBill.OrderExpensesBillSto;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 订单费用表
 */
@Data
@NoArgsConstructor()
@EqualsAndHashCode(callSuper = true)
public class OrderExpensesBillItem extends AbstractSimpleAggregate<Long> {

  public OrderExpensesBillItem(OrderExpensesBillSto.OrderExpensesBillItemSto sto) {
    ValidationUtils.validate(sto);
    super.initDefault();
    this.expenses = sto.getExpenses();
    this.remark = sto.getRemark();
    this.expenseResponsible = sto.getExpenseResponsible();
    this.includeTotalAmount = sto.getIncludeTotalAmount();
  }

  public OrderExpensesBillItem(OrderExpensesBillMto.OrderExpensesBillItemMto mto) {
    ValidationUtils.validate(mto);
    this.expenses = mto.getExpenses();
    this.remark = mto.getRemark();
    this.expenseResponsible = mto.getExpenseResponsible();
    this.includeTotalAmount = mto.getIncludeTotalAmount();
  }

  /**
   * 订单费用表id
   */
  private Long expensesBillId;
  /**
   * 原始单类型(1：销售单、2：采购单)
   */
  private Short orderType;
  /**
   * 单价
   */
  private BigDecimal expenses;
  /**
   * 订单备注
   */
  private String remark;
  /**
   * 费用承担方(0:我方承担 1:对方承担)
   */
  private Short expenseResponsible;
  /**
   * 纳入总额(0:不纳入总额 1:纳入总额)
   */
  private Short includeTotalAmount;

}
